{template '_header'}
<div class="page-heading">
    <span class="pull-right">
        <a class="btn btn-danger btn-sm"data-toggle="modal" data-target="#myModal"><i class="fa fa-trash"></i> 删除全部文件</a>
    </span>
    <h2>文件管理 <small>共 <span class="text-danger">{php echo count($file);}</span> 条</small></h2>

</div>
    <div class="page-content" style="display: block;">

        <div class="main">
            <div class="panel-default">
                <div class="panel-body table-responsive" style="padding:0;">
                    <form action="" method="post">
                        <table class="table table-hover table-bordered">
                            <thead class="navbar-inner">
                            <tr>
                                <th style="width:40px; text-align: center;">排序</th>
                                <th style="width:60px;text-align: center;">文件类型</th>
                                <th style="width:180px;text-align: center;">文件名</th>
                                <th style="width:80px;text-align: center;">文件大小</th>
                                <th style="width:150px;text-align: center;">生成时间</th>
                                <th style="width:80px;text-align: center;">操作</th>
                            </tr>
                            </thead>
                            <tbody style="text-align: center;">
                            {php $i = 1;}
                            {loop $file $key $value}
                            <tr>
                                <td>{$i}</td>
                                <td>{if $value['type']==0}文件夹{elseif $value['type']==1}压缩包{elseif $value['type']==2}文本文档{elseif $value['type']==3}表格{/if}</td>
                                <td>{$value['name']}</td>
                                <td>{$value['size']}字节</td>
                                <td style="color: #1a7bb9;">{php echo date('Y-m-d H:i:s',$value['time']);}</td>
                                <td>
                                    {if !empty($value['type'])}<a href="../addons/ewei_shopv2/data/qrcode/{$_W['uniacid']}/exchange/{$value['name']}" class="btn btn-success btn-xs" download="{$value['name']}">下载</a>&nbsp;{/if}
                                    <a data-toggle="ajaxRemove" href="{php echo webUrl('exchange/setting/filedel',array('fname'=>$value['name'],'ftype'=>$value['type']));}" class="btn btn-danger btn-xs" data-confirm="确认删除{$value['name']} 吗？">删除</a> </td>
                            </tr>
                            {php $i++;}
                            {/loop}
                            </tbody>
                        </table>
                    </form>
                    <div style="text-align:right;width:100%;">
                    </div>
                </div>
            </div>
        </div>
    </div>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top: 300px;">
    <div class="modal-dialog">
        <div class="modal-content" style="width: 500px">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h3 class="modal-title" id="myModalLabel">
                    确认删除
                </h3>
            </div>
            <div class="modal-body">
                    确认删除全部兑换码打包文件？删除后将无法下载过去的兑换码打包文件！
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消
                </button>
                <button type="button" class="btn btn-primary suredel">
                    确认删除
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('.suredel').click(function () {
            $.ajax({
                url:"{php echo webUrl('exchange/setting/delall');}",
                success:function () {
                    window.location.reload();
            }});
        });
    });
</script>
{template '_footer'}